<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>deCapitalize</title>
</head>

<body>
    <div>打开浏览器控制台查看结果</div>
    <script>
        const deCapitalize = ([first, ...rest], upperRest = false) =>
            first.toLowerCase() +
            (upperRest ? rest.join('').toUpperCase() : rest.join(''));
        console.log(deCapitalize('FooBar')); // 'fooBar'
        console.log(deCapitalize('FooBar', true)); // 'fOOBAR'
    </script>
</body>

</html>